var GMIdentify = {
	mapClickIdentify: null,
	muiContentClick: null,
	identifiedMarker: null,
	identifiedGraphicLayer: null,
	beginIdentify: function() {
		GMIdentify.mapClickIdentify = MAP.on("click", this.executeIdentifyTask);
	},
	executeIdentifyTask: function(event) {
		//		console.log('touch')
		if (GMIdentify.identifiedGraphicLayer) {
			MAP.removeLayer(GMIdentify.identifiedGraphicLayer);
		}
		if (GMIdentify.identifiedMarker) {
			MAP.removeLayer(GMIdentify.identifiedMarker);
		}
		var latlonPoint = new L.LatLng(event.lat, event.lng)

		// if (MAP.addLayer(MapObj.landuseQuery)) {
		// 	MapObj.landuseQuery.identify().layers('2').tolerance(10).on(MAP).at(latlonPoint).run(function(error,
		// 		featureCollection) {
		// 		console.log('touch')
		// 		if (featureCollection.features.length > 0) {
		// 			// 查出多个只显示第一个
		// 			var resultFeature = featureCollection.features[0];
		// 			if (GMIdentify.identifiedGraphicLayer) {
		// 				MAP.removeLayer(GMIdentify.identifiedGraphicLayer);
		// 			}
		// 			GMIdentify.identifiedGraphicLayer = L.geoJSON(resultFeature).addTo(MAP); //增加style可改变样式
		// 			GMQuery.showInfowindow(resultFeature);
		// 			//				GMQuery.zoomToPolygon(resultFeature.geometry)
		// 		} else {
		// 			GMQuery.closeBottomWindow();
		// 		}
		// 	});
		// }else if (MAP.addLayer(MapObj.deepwellLayer)){

		if (window.flag == true) {
			MapObj.deepwellLayer.identify().layers('2').tolerance(10).on(MAP).at(latlonPoint).run(function(error,
				featureCollection,response) {
					console.log(response,"1212122122")
				console.log('touch')
				console.log(featureCollection,"****")
				if (featureCollection.features.length > 0) {
					// 查出多个只显示第一个
					var resultFeature = featureCollection.features[0];
					console.log(featureCollection)
					if (GMIdentify.identifiedGraphicLayer) {
						MAP.removeLayer(GMIdentify.identifiedGraphicLayer);
					}
					GMIdentify.identifiedGraphicLayer = L.geoJSON(resultFeature).addTo(MAP); //增加style可改变样式
					GMQuery.showInfowindow(resultFeature);
					console.log(resultFeature,"52行")
					//GMQuery.zoomToPolygon(resultFeature.geometry)
				} else {
					GMQuery.closeBottomWindow();
				}
			});

		} else if (window.show == true) {
			MapObj.landuseQuery.identify().layers('2').tolerance(10).on(MAP).at(latlonPoint).run(function(error,
				featureCollection,response) {
				console.log('touch')
				console.log(featureCollection,"^^^^^")
			
				if (featureCollection.features.length > 0) {
					// 查出多个只显示第一个
					var resultFeature = featureCollection.features[0];
					console.log(resultFeature,"67hang")
					if (GMIdentify.identifiedGraphicLayer) {
						MAP.removeLayer(GMIdentify.identifiedGraphicLayer);
					}
					GMIdentify.identifiedGraphicLayer = L.geoJSON(resultFeature).addTo(MAP); //增加style可改变样式
					GMQuery.showInfowindow(resultFeature);
					//				GMQuery.zoomToPolygon(resultFeature.geometry)
				} else {
					GMQuery.closeBottomWindow();
				}
			});
		}

		// }

	},

	newP: function(pt) {
		var xx = pt.x;
		var yy = pt.y;
		var rr = parseFloat(10) * lengthConverParam; //10米范围内
		var polygonJson = {
			"rings": [
				[
					[xx + rr, yy + rr],
					[xx + rr, yy - rr],
					[xx - rr, yy - rr],
					[xx - rr, yy + rr],
					[xx + rr, yy + rr]
				]
			],
			"spatialReference": {
				"wkid": 4326
			}
		};
		var polygon = new esri.geometry.Polygon(polygonJson);
		return polygon;
	},

}
